﻿@using Wicresoft.UnifyShow.Business;
@{
    ViewBag.Title = "IT服务统计";
    Layout = "~/Views/Shared/_LayoutSummary.cshtml";
    List<BusinessSystemModel> siteContains = (List<BusinessSystemModel>)ViewData["SitesContainsTheBS"];
}
<div class="right_title2">
    <a href="@Url.Action("index", "Home")">首页</a> > 业务状态总览 > @ViewData["ServiceAlias"]>
    <span>IT服务统计</span></div>
@*<input type="hidden" value="@ViewData["ServiceName"]" id="serviceName"/>*@
<input type="hidden" value="@ViewData["ServiceAlias"]" id="serviceAlias"/>
<input type="hidden" value="@ViewData["ServiceID"]" id="serviceID"/>
<input type="hidden" value="@ViewBag.SiteID" id="siteID"/>
<div class="class">
    <div class="tab_area">
        <ul class="tab_head tabs">
            @foreach (var item in ViewBag.Sites)
            {
                if (item.ID == ViewBag.SiteID)
                { 
                <li data-local="@item.ID" data-bs="@siteContains.FirstOrDefault(o => o.SiteID == item.ID).ID" data-select="true">
                    <a href="#@item.Name">@item.Alias</a></li>
                }
                else
                { 
                <li data-local="@item.ID" data-bs="@siteContains.FirstOrDefault(o => o.SiteID == item.ID).ID" >
                    <a href="#@item.Name">@item.Alias</a></li>
                }
            }
        </ul>
        <div class="tab_container">
            <div class="tab_content" id="tab1">
                <div class="search">
                    <div class="search_bg">
                        <h2>
                            筛选条件</h2>
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td width="8%">
                                        开始时间:
                                    </td>
                                    <td width="22%">
                                        <input class="InputStyle1" type="text" id="startTime" />
                                    </td>
                                    <td width="8%">
                                        结束时间:
                                    </td>
                                    <td width="22%">
                                        <input class="InputStyle1" type="text" id="endTime" />
                                    </td>
                                </tr>
                                <tr style="display: none;">
                                    <td width="8%">
                                        归属地:
                                    </td>
                                    <td width="22%">
                                        <select>
                                            <option>南平(默认)</option>
                                            <option>宁德</option>
                                            <option>三明</option>
                                        </select>
                                    </td>
                                    <td width="8%">
                                        应用系统:
                                    </td>
                                    <td width="22%">
                                        <input class="InputStyle1" type="text" value="@ViewData["ServiceAlias"]" />
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <p>
                            <input class="Button2 ui-icons" id="Reset" title="Reset" value="重置" type="button" />
                            <input class="Button2 ui-icons" id="Select" title="Select" value="查看" type="button" /></p>
                    </div>
                </div>
                <div class="index_lr index_lr_tab" id="index_lr_tab">
                    <!--**************************************************************************************************************************************************-->
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
        <div class="clear">
        </div>
    </div>
</div>
@section ScriptAndCss
{
    <script type="text/javascript">
        function initTheReport()
        {
            $('.report').load(function(){
             $(this).parent().hideLoading();
            }).error(function(){
            $(this).parent().hideLoading();
            });
            $('.report').each(function()
            {
              var method=$(this).attr("data-parameter");
              var coclass=$(this).attr("alt");
              var url="/"+coclass+"/"+method;
              url+="?sid="+$("#siteID").val()+"&bnid="+$("#serviceID").val()+"&sTime="+$("#startTime").val()+"&eTime="+$("#endTime").val()+"&_="+Math.floor((Math.random()*1000000000)+1);
              $(this).attr("src",url);
              $(this).parent().showLoading();
            });
        }


        $(document).ready(function () {

            $("#Select").click(function () {
            if ( $("#startTime").val()== "" ||  $("#endTime").val()== "") {
            alert("请输入日期后查询!");
                return;}
            var url="@Url.Action("GetCharts", "ITBusinessStatistics")";
            $("#index_lr_tab").load(url,function()
            {
            initTheReport();
            });
            });

            $("li", "ul.tabs").click(function () {
                $("li", "ul.tabs").removeClass("c ui-icons"); //Remove any "active" class 
                $(this).addClass("c ui-icons"); //Add "active" class to selected tab 
                $("#siteID").val($(this).attr("data-local"));
                $("#serviceID").val($(this).attr("data-bs"));
                $("#Reset").click();
            });

            $("#Reset").click(function () {
                $("#startTime").val(getDateThreeMonthStartString());
                  var date1=new Date();
                            date1.setDate(date1.getDate()+1);
                            $("#endTime").val(getDateString(date1));
                $("#Select").click();
            });
            
            $("li[data-select='true']", "ul.tabs").click();
            
            $("#startTime").datepicker();
            $("#endTime").datepicker();
        });

    </script>
}
@section  LeftMenu {
    <li><a href="@Url.Action("Index", "BusinessAvailable", new { businessSystemId = ViewData["ServiceID"] })">
        业务健康度总览</a></li>
    <li><a href="@Url.Action("Index", "BasicEnvironmentStatus", new { businessSystemId = ViewData["ServiceID"] })">
        基础环境状态</a></li>
    <li class="VNavLeaf ui-icons">IT服务统计</li>
    <li><a href="@Url.Action("Index", "ServiceLevelAgreement", new { businessSystemId = ViewData["ServiceID"] })">
        服务水平统计</a></li>
}
